<%@ include file="/taglibs.jsp"%>

<fmt:message key="date.format" var="df" scope="page"/>

<head>
	<title><fmt:message key="fileList.title"/></title>
	<script type="text/javascript" src="${ctx}/scripts/checkbox.js"></script>
</head>

<s:set name="files" value="files" scope="request"/>
<s:form name="fileMgrForm" action="fileMgrs" method="post">
    <s:select key="file.field" name="fieldId" list="fields" listKey="id" listValue="name" headerKey="%{getText('select.default.key')}" headerValue="%{getText('select.default.value')}"></s:select>
<tr>
	<td>
        <s:property value="getText('file.outputDate')"/>
    </td>
    <td>
        <s:textfield id="toDate" name="toDate" size="11" theme="simple"/>
        <button id="toDateCal" type="button" class="button"> ... </button> 
        [<fmt:message key="date.format"/>]
    </td>
</tr>
<s:textfield name="content" key="file.content" size="70"/>
<tr>
	<td><s:submit cssClass="button" name="search" value="%{getText('button.search.title')}" theme="simple" onclick="this.blur()"></s:submit></td>
	<td>
        &nbsp;
    </td>
</tr>
</s:form>

<s:form name="rf" action="returnFile" method="post">
<s:set var="item_name" value="%{getText('file.item_name')}" scope="page"></s:set>
<s:set var="items_name" value="%{getText('file.items_name')}" scope="page"></s:set>
<display:table name="files" class="table" requestURI="" id="fileList" pagesize="10" >
	<display:column title="<input type='checkbox' id='chkAll'>">
		<input type="checkbox" name="fileIds" class="checkbox" value="${fileList[0].id},${fileList[2]}">
	</display:column>
	<display:setProperty name="paging.banner.item_name" value="${item_name}"/>
	<display:setProperty name="paging.banner.items_name" value="${items_name}"/>
    <display:column property="[0].id" sortable="true" titleKey="file.id">
    </display:column>
    <display:column property="[0].sender" sortable="true" titleKey="file.sender" escapeXml="true">
    </display:column>
    <display:column property="[0].content" sortable="true" titleKey="file.content" escapeXml="true">
    </display:column>
    <display:column sortable="true" titleKey="file.outputDate" escapeXml="true">
    	<fmt:formatDate value="${fileList[0].outputDate}" pattern="${df}"/>
    </display:column>
    <display:column property="[1]" sortable="true" titleKey="file.status" escapeXml="true">
    </display:column>
</display:table>
<s:if test="%{files != null and !files.isEmpty()}">
	<s:submit cssClass="button" name="return" value="%{getText('button.file.return')}" theme="simple" onclick="this.blur()"></s:submit>
</s:if>
</s:form>

<script type="text/javascript">
	highlightTableRows("fileList");
	new Calendar({
	    inputField: "toDate",
	    dateFormat: "%m/%d/%Y",
	    trigger: "toDateCal",
	    bottomBar: false,
	    onSelect: function() { this.hide(); }
	});
</script>
